package com.sunyard.pcc.core.service;

import com.sunyard.pcc.common.bo.SysMenuBO;
import com.sunyard.pcc.common.bo.SysMenuQueryBO;
import com.sunyard.pcc.common.bo.SysUserBO;
import com.sunyard.pcc.common.exception.PccCommonException;

import java.util.List;
import java.util.Set;

/**
 * @Author: Hewei
 * @Description:
 * @Date: Created in 9:49 2018/3/7
 */
public interface MenuService {

    /**
     * 根据角色编号查询对应菜单集合
     *
     * @param roleIds
     * @return
     * @throws PccCommonException
     */
    List<SysMenuBO> queryMenusByRoleIDs(List<Long> roleIds) throws PccCommonException;


    /**
     * 根据用户id查询用户对应菜单列表
     *
     * @param userID
     * @return
     * @throws PccCommonException
     */
    Set<Long> queryAllMenuIdsByUserId(Long userID) throws PccCommonException;


    /**
     * 根据用户查询其菜单，按钮结构
     *
     * @param sysUserBO
     * @return
     * @throws PccCommonException
     */
    List<SysMenuBO> getUserMenuList(SysUserBO sysUserBO) throws PccCommonException;


    /**
     * 校验用户是否有该菜单对应URL的访问权限
     *
     * @param menu       特定菜单
     * @param sysMenuBOS 用户拥有权限的菜单列表
     * @return
     * @throws PccCommonException
     */
    Boolean hasPermissionToMenu(SysMenuBO menu, List<SysMenuBO> sysMenuBOS) throws PccCommonException;

    /**
     * 添加新菜单栏
     *
     * @param menu 新菜单数据
     * @return
     */
    Boolean addNewMenu(SysMenuBO menu) throws PccCommonException;


    /**
     * 删除id对应菜单
     * @param menuId
     * @return
     * @throws PccCommonException
     */
    Boolean deleteMenuById(Long menuId) throws PccCommonException;


    /**
     * 根据父菜单id查询子菜单列表
     * @param menuId 父菜单Id
     * @return
     * @throws PccCommonException
     */
    List<SysMenuBO> selectChildrenMenuById(Long menuId) throws PccCommonException;


    /**
     * 更新对应id的menu数据
     * @param menuId menu编号
     * @param sysMenuBO 新菜单编号
     * @return
     * @throws PccCommonException
     */
    Boolean updateMenu(Long menuId, SysMenuBO sysMenuBO) throws PccCommonException;

    /**
     * 条件查询 菜单列表 树形结构
     * @return
     * @throws PccCommonException
     */
    List<SysMenuBO> getMenuListInTreeMode() throws PccCommonException;


    /**
     * 查询菜单列表
     * @return
     * @throws PccCommonException
     */
    List<SysMenuBO> getMenuList() throws PccCommonException;

    /**
     * 条件查询菜单总数
     * @param sysMenuQueryBO
     * @return
     * @throws PccCommonException
     */
    Integer getCountByRequirementInTreeMode(SysMenuQueryBO sysMenuQueryBO) throws PccCommonException;

    /**
     * 计算一个菜单列表下总共有几条数据
     * @param menus
     * @return
     * @throws PccCommonException
     */
    Integer menuListCounts(List<SysMenuBO> menus) throws PccCommonException;



}
